/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package todotask.model;

import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import todotask.Database.Data;
import todotask.entities.Category;

/**
 *
 * @author dakota
 */
public class ListCategoryModel extends DefaultComboBoxModel {

    private Data d = new Data();
    
    public ListCategoryModel() {
        try {
            Category[] list = d.getCategories();
            for(Category c : list){
                addElement(c);
            }
        } catch (SQLException ex) {//Lanzar a una clase gestor de errores
            Logger.getLogger(ListCategoryModel.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
